package com.blog.Bard.base.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.blog.Bard.base.pojo.BardArticle;
import com.blog.Bard.common.dao.BaseRepository;

public interface BardArticleDao extends BaseRepository<BardArticle, Integer> {

	/**
	 * 	删除文章类型
	 * @param id
	 * @throws Exception
	 */
	@Modifying
	@Query(nativeQuery = true, value=" delete from BardArticleAndType where articleId = :id ")
	void delType(@Param("id")Integer id) throws Exception;
	
	/**
	 * 	保存文章类型
	 * @param id
	 * @param articleType
	 * @throws Exception
	 */
	@Modifying
	@Query(nativeQuery = true, value=" insert into BardArticleAndType(articleId, articleTypeId) values(:id, :articleType) ")
	void saveType(@Param("id")Integer id, @Param("articleType")Integer articleType) throws Exception;
	
	/**
	 * 删除标签
	 * @param id
	 * @throws Exception
	 */
	@Modifying
	@Query(nativeQuery = true, value=" delete from bardarticleandlabel where articleId = :id ")
	void delLabels(@Param("id")Integer id) throws Exception;
}
